var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        });
Object.defineProperty(i, "__esModule", {value: !0}), (i.BevNodeTerminal = void 0);
var r = e("BehaviorTree"),
    s = (function (e) {
        function t(t, o) {
            void 0 === o && (o = null);
            var n = e.call(this, t, o) || this;
            return (n.me_Status = r.E_TerminalNodeStaus.k_TNS_Ready), (n.mb_NeedExit = !1), n;
        }
        return (
            a(t, e),
            (t.prototype._DoTransition = function (e) {
                this.mb_NeedExit && this._DoExit(e, r.BevRunningStatus.k_BRS_ERROR_Transition),
                    this.SetActiveNode(null),
                    (this.me_Status = r.E_TerminalNodeStaus.k_TNS_Ready),
                    (this.mb_NeedExit = !1);
            }),
            (t.prototype._DoTick = function (e, t) {
                var o = r.BevRunningStatus.k_BRS_Finish;
                return (
                    this.me_Status === r.E_TerminalNodeStaus.k_TNS_Ready &&
                        (this._DoEnter(e),
                        (this.mb_NeedExit = !0),
                        (this.me_Status = r.E_TerminalNodeStaus.k_TNS_Running),
                        this.SetActiveNode(this)),
                    this.me_Status === r.E_TerminalNodeStaus.k_TNS_Running &&
                        ((o = this._DoExecute(e, t)),
                        this.SetActiveNode(this),
                        (o === r.BevRunningStatus.k_BRS_Finish || o < 0) &&
                            (this.me_Status = r.E_TerminalNodeStaus.k_TNS_Finish)),
                    this.me_Status === r.E_TerminalNodeStaus.k_TNS_Finish &&
                        (this.mb_NeedExit && this._DoExit(e, o),
                        (this.me_Status = r.E_TerminalNodeStaus.k_TNS_Ready),
                        (this.mb_NeedExit = !1),
                        this.SetActiveNode(null)),
                    o
                );
            }),
            t
        );
    })(e("BevNode").BevNode);
i.BevNodeTerminal = s;
